# 使用node 20作为基础镜像
FROM node:20.3.0 as builder

# 设置工作目录
WORKDIR /app

# 将本地代码复制到镜像内的工作目录
COPY . /app

EXPOSE 8888
# 指定容器时区为上海 && 安装依赖
ENV TZ Asia/Shanghai
 
RUN ln -fs /usr/share/zoneinfo/${TZ} /etc/localtime \
    && echo ${TZ} > /etc/timezone \
    && rm -rf node_modules/ yarn.lock \
    && yarn config set "strict-ssl" false -g \
    && yarn config set ignore-engines true \
    && yarn config set registry https://registry.npm.taobao.org/ \
    # && yarn --unsafe-perm \
    && yarn install

# 启动应用
CMD ["yarn", "prd"]
